#ifndef __FLASH_H_
#define __FLASH_H_

#include "stm32f4xx.h"
#include "main.h"

//FLASH sector start address
#define ADDR_FLASH_SECTOR_0     ((u32)0x08000000) 	//sector 0 address, 16 Kbytes  
#define ADDR_FLASH_SECTOR_1     ((u32)0x08004000) 	//sector 1 address, 16 Kbytes  
#define ADDR_FLASH_SECTOR_2     ((u32)0x08008000) 	//sector 2 address, 16 Kbytes  
#define ADDR_FLASH_SECTOR_3     ((u32)0x0800C000) 	//sector 3 address, 16 Kbytes  
#define ADDR_FLASH_SECTOR_4     ((u32)0x08010000) 	//sector 4 address, 64 Kbytes  
#define ADDR_FLASH_SECTOR_5     ((u32)0x08020000) 	//sector 5 address, 128 Kbytes  
#define ADDR_FLASH_SECTOR_6     ((u32)0x08040000) 	//sector 6 address, 128 Kbytes  
#define ADDR_FLASH_SECTOR_7     ((u32)0x08060000) 	//sector 7 address, 128 Kbytes  
#define ADDR_FLASH_SECTOR_8     ((u32)0x08080000) 	//sector 8 address, 128 Kbytes  
#define ADDR_FLASH_SECTOR_9     ((u32)0x080A0000) 	//sector 9 address, 128 Kbytes  
#define ADDR_FLASH_SECTOR_10    ((u32)0x080C0000) 	//sector 10 address,128 Kbytes  
#define ADDR_FLASH_SECTOR_11    ((u32)0x080E0000) 	//sector 11 address,128 Kbytes  

FLASH_Status erase_app_sector(void);
void flash_write(uint32_t address, uint32_t data);
uint8_t Flash_erase(u32 addr, u32 size);



#endif /* __FLASH_H_ */